<html>
<head>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var navigatedFrames = 0;

function checkResults()
{
    var testStatus = document.getElementById('testStatus');

    if (self.navigated.location.href.indexOf('parent.html') == -1)
        testStatus.innerHTML = 'FAIL: disallowed frame navigated';
    else if (navigatedFrames == 10)
        testStatus.innerHTML = 'PASS';
    else
        testStatus.innerHTML = 'FAIL: frames not navigated properly';

    if (window.testRunner)
        testRunner.notifyDone();
}

function countFrame()
{
    ++navigatedFrames;

    if (navigatedFrames == 10)
        checkResults();
}

</script>
</head>

<body>

    <p>This test verifies that a sandboxed IFrame cannot navigate an ancestor
    in the frame tree by assigning the location attribute.</p>

    <p>This is done by loading ten non-sandboxed IFrames, and a single
    sandboxed one. Expect ten frames to be navigated, but the sandboxed
    one to <b>not</b> be one of them.</p>

    <p>This test will print &quot;PASS&quot; on success.</p>

    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>

    <iframe name='navigated'
            src="resources/sandboxed-iframe-navigation-parent.html">
    </iframe>

    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>
    <iframe src="resources/non-sandboxed-iframe-navigation.html"></iframe>

    <p id='testStatus'>FAIL: Script didn't run</p>

</body>
</html>
